/*
 * message.h
 *
 *  Created on: 05.12.2013
 *      Author: Strohmi
 */

#ifndef MESSAGE_H_
#define MESSAGE_H_

#include "protocol.h"
#include <stdio.h>
#include <string.h>

class message {
private:
	unsigned char payload[MSG_LENGTH];

public:
	message();
	message(unsigned char sensorID, MESSAGE_TYPE msgType);
	message(unsigned char sensorID, COM_TYPE comType);
	message(unsigned char sensorID, SENSOR_TYPE sensorType, VALUE_TYPE valueType, unsigned char length);
	message(unsigned char* msg, char length);

	void setValue(unsigned char value);
	void setValue(unsigned int value);
	void setValue(unsigned long value);
	void setValue(char value);
	void setValue(int value);
	void setValue(long value);
	void setValue(float value);

	void setLength(unsigned char length);
	void setValueType(VALUE_TYPE valueType);
	void setSensorType(SENSOR_TYPE sensorType);
	void setAddress(unsigned char addr);
	
	
	float getFloat();
	int getInt();
	unsigned int getUInt();


	int getLength();
	int getSensorID();
	unsigned int getAddress();
	
	int getComType();
	int getValueType();
	int getSensorType();
	int getMsgType();

	char* getComTypeString();
	char* getValueTypeString();
	char* getSensorTypeString();
	char* getMsgTypeString();

	unsigned char* toCharArray();
	void print();


	virtual ~message();
};

#endif /* MESSAGE_H_ */
